/**
 * 
 */
package com.adel.springIoc.dao;

import java.util.ArrayList;
import java.util.List;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import com.adel.springIoc.beans.User;

/**
 * @author adruhora
 * 
 */
@Component
@Qualifier("daoImpl")
public class UserDaoImpl implements UserDao {
	
	List<User> users = new ArrayList<User>();

	public User getUserById(Integer id) {
		User user = new User("Cucu", 15);
		return user;
	}

	public int saveUser(User user) {
		users.add(user);
		return users.size();
	}

	public int updateUser(User user) {
		// TODO Auto-generated method stub
		return 0;
	}

	public void deleteUser(User user) {
		// TODO Auto-generated method stub

	}

	public List<User> getUsers() {
		System.out.println("UserDaoImpl");
		return users;
	}

	/*
	 * private SimpleJdbcTemplate jdbcTemplate;
	 * 
	 * public String getMessage(String messageKey) { return
	 * jdbcTemplate.queryForObject(
	 * "select message from messages where messagekey = ?", String.class,
	 * messageKey); }
	 * 
	 * @Autowired public void createTemplate(DataSource dataSource) {
	 * this.jdbcTemplate = new SimpleJdbcTemplate(dataSource); }
	 */

}
